package com.fjw.service.impl;

import com.fjw.dao.SysUserMapper;
import com.fjw.pojo.SysUser;
import com.fjw.service.SysUserService;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SysUserServiceImpl implements SysUserService {

    //注册dao
    @Autowired
    private SysUserMapper sysUserMapper;


    @Override
    public SysUser queryByUsername(String username ) {
        //调用方法
        return sysUserMapper.selectUserByUsername(username);
    }

    @Override
    public Integer updatePassword(String username, String newPassword) {
        //对密码进行加密处理

        String newPasswordJm = new Md5Hash(newPassword).toBase64();
        return sysUserMapper.updatePassword(username,newPasswordJm);
    }
}
